//
//  IWWindowTool.m
//  WeiBo17
//
//  Created by teacher on 15/8/19.
//  Copyright (c) 2015年 itcast. All rights reserved.
//

#import "IWWindowTool.h"
#import "IWAccount.h"
#import "IWTabBarController.h"
#import "IWOAuthViewCtrl.h"
#import "IWAccountTool.h"
#import "AppDelegate.h"

@implementation IWWindowTool

+ (void)switchRootViewCtrl{
    //判断是否有登录过
    IWAccount* accont = [IWAccountTool account];
    
    //取出appdelegate里面的window
    UIWindow* window = ((AppDelegate *)[UIApplication sharedApplication].delegate).window;
//    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    if (accont) {
        //代表已经登录过
        window.rootViewController = [IWTabBarController new];
    }else {
        //进入登录界面
        window.rootViewController = [IWOAuthViewCtrl new];
    }
}

@end
